{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 26.模块"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 26.1 导入与用法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9974949866040544"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import math\n",
    "math.sin(1.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'cos' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-2-25c1f7923f0b>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mcos\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1.5\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m#报错，NameError: name 'cos' is not defined\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'cos' is not defined"
     ]
    }
   ],
   "source": [
    "cos(1.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9974949866040544"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import math as mt\n",
    "mt.sin(1.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.0707372016677029"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from math import cos\n",
    "cos(1.5) "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 26.2 查看内置模块清单的方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('_ast',\n",
       " '_bisect',\n",
       " '_blake2',\n",
       " '_codecs',\n",
       " '_codecs_cn',\n",
       " '_codecs_hk',\n",
       " '_codecs_iso2022',\n",
       " '_codecs_jp',\n",
       " '_codecs_kr',\n",
       " '_codecs_tw',\n",
       " '_collections',\n",
       " '_csv',\n",
       " '_datetime',\n",
       " '_findvs',\n",
       " '_functools',\n",
       " '_heapq',\n",
       " '_imp',\n",
       " '_io',\n",
       " '_json',\n",
       " '_locale',\n",
       " '_lsprof',\n",
       " '_md5',\n",
       " '_multibytecodec',\n",
       " '_opcode',\n",
       " '_operator',\n",
       " '_pickle',\n",
       " '_random',\n",
       " '_sha1',\n",
       " '_sha256',\n",
       " '_sha3',\n",
       " '_sha512',\n",
       " '_signal',\n",
       " '_sre',\n",
       " '_stat',\n",
       " '_string',\n",
       " '_struct',\n",
       " '_symtable',\n",
       " '_thread',\n",
       " '_tracemalloc',\n",
       " '_warnings',\n",
       " '_weakref',\n",
       " '_winapi',\n",
       " 'array',\n",
       " 'atexit',\n",
       " 'audioop',\n",
       " 'binascii',\n",
       " 'builtins',\n",
       " 'cmath',\n",
       " 'errno',\n",
       " 'faulthandler',\n",
       " 'gc',\n",
       " 'itertools',\n",
       " 'marshal',\n",
       " 'math',\n",
       " 'mmap',\n",
       " 'msvcrt',\n",
       " 'nt',\n",
       " 'parser',\n",
       " 'sys',\n",
       " 'time',\n",
       " 'winreg',\n",
       " 'xxsubtype',\n",
       " 'zipimport',\n",
       " 'zlib')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "sys.builtin_module_names"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
